﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="faq.aspx.cs" Inherits="EnmineKaitlin.admin.faq" MasterPageFile="~/MasterPage/AdminDefault.Master" %>
<%@ Register Assembly="EnmineKaitlin" Namespace="EnmineKaitlin.Common" TagPrefix="Pagging" %>
<asp:Content ID="ctnFAQ" runat="server" ContentPlaceHolderID="cphContent">
<div class="form list">
    <h2><span class="icon"><img src="../images/admin/Play.png"></span><asp:Label ID="lblFunction" runat="server"></asp:Label></h2>
    <div class="content">
        <asp:Panel ID="pnlList" runat="server">
            <asp:Label ID="lblNotice" CssClass="error" runat="server"></asp:Label>
            <div class="filter">                                
                <div class="function left">
                    <asp:LinkButton ID="lbtFunctionTop" runat="server" Text="Xóa câu hỏi" CssClass="link-btn" CommandName="BunkFunction" OnCommand="lbtFunction_Click" CommandArgument="TopFunction"></asp:LinkButton>
                    &nbsp;&nbsp;&nbsp;&nbsp;Trạng thái:&nbsp;
                    <asp:DropDownList ID="ddlStatus" runat="server">
                        <asp:ListItem Text="Tất cả" Value=""></asp:ListItem>    
                        <asp:ListItem Text="Chờ duyệt" Value="pending"></asp:ListItem>    
                        <asp:ListItem Text="Đã duyệt" Value="publish"></asp:ListItem>    
                    </asp:DropDownList>
                </div>
                <div class="function left">                    
                    &nbsp;&nbsp;&nbsp;&nbsp;Chuyên mục:&nbsp;
                    <asp:DropDownList ID="ddlCategory" runat="server" DataValueField="CatID" DataTextField="CatName"></asp:DropDownList>
                </div>                                
                <div class="function left">
                    &nbsp;&nbsp;&nbsp;&nbsp;<asp:Button ID="btnFilter" runat="server" Text="Lọc" CssClass="link-btn" OnClick="btnFilter_Click" />
                </div>
            </div>    
            <asp:GridView ID="grvFAQ" runat="server" Width="100%"
             AutoGenerateColumns="false" DataKeyNames="FAQID" CssClass="tbl-list" 
                AlternatingRowStyle-BackColor="AntiqueWhite" 
                onrowdatabound="grvFAQ_RowDataBound" OnRowCommand="grvFAQ_RowCommand" 
                onrowdeleting="grvFAQ_RowDeleting" >
                <Columns>                                                        
                    <asp:TemplateField HeaderText="">
                        <ItemTemplate><asp:CheckBox ID="CheckBox1" runat="server" CssClass="cbxItem" /></ItemTemplate>
                    </asp:TemplateField>                    
                    <asp:BoundField HeaderText="Tác giả" DataField="Sender" />                    
                    <asp:BoundField HeaderText="Câu hỏi" DataField="Question" />                                                        
                    <asp:TemplateField HeaderText="Trả lời">
                        <ItemTemplate>
                            <%#Eval("Answer").ToString() %>
                        </ItemTemplate>                        
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Thao tác" ItemStyle-Width="60">
                        <ItemTemplate>
                            <a href='/admin/faq.aspx?q=<%#Eval("FAQID") %>' class="btnEdit">Sửa</a>
                            <asp:LinkButton ID="lbtDelete" runat="server" CssClass="btnDelete" Text="Xóa" CommandName="Delete" CommandArgument='<%#Eval("FAQID") %>'></asp:LinkButton>
                        </ItemTemplate>
                    </asp:TemplateField>                                                           
                </Columns>
            </asp:GridView>
            <div class="pagenav">
                <Pagging:PaggingControl runat="server" ID="ctlPagging" Mode="Url" PageSize="20"
                PreviousClause="<img src='../images/Back.png'/>" NextClause="<img src='../images/Forward.png'/>" />
            </div>                                                        
        </asp:Panel>
        <asp:Panel ID="pnlDetail" runat="server" Visible="false">
            <asp:Repeater ID="rptUpdate" runat="server" OnItemCommand="btnUpdate_Click">
                <ItemTemplate>
                    <table border="0">
                        <tr><td>Tên liên hệ:(*)</td><td><asp:TextBox ID="txtName" Enabled="false" runat="server" Text='<%#Eval("Sender") %>' Width="250" CssClass="txt required"></asp:TextBox></td></tr>                    
                        <tr><td>Ngày gửi:(*)</td><td><asp:TextBox ID="txtSendDate" Enabled="false" Text='<%#Eval("SendDate") %>' runat="server" Width="250" CssClass="txt required"></asp:TextBox></td></tr>
                        <tr><td>Chuyên mục:</td><td><asp:DropDownList ID="ddlCategory" runat="server" Width="256" CssClass="select" DataTextField="CatName" DataValueField="CatID" DataSource='<%#BindCategory() %>' SelectedValue='<%#Eval("CatID") %>'></asp:DropDownList></td></tr>
                        <tr><td>Câu hỏi:(*)</td><td><asp:TextBox ID="txtQuestion" TextMode="MultiLine" Width="500" Text='<%#Eval("Question") %>' Height="100" CssClass="textarea required" runat="server"></asp:TextBox></td></tr>
                        <tr><td>Trả lời:(*)</td><td><asp:TextBox ID="txtAnswer" TextMode="MultiLine" Width="500" Text='<%#Eval("Answer") %>' Height="200" CssClass="textarea required" runat="server"></asp:TextBox></td></tr>
                        <tr><td></td><td><asp:Button ID="btnUpdate" runat="server" Text="Cập nhật" CssClass="link-btn" CommandArgument='<%#Eval("FAQID") %>' CommandName="Update" />
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<asp:LinkButton ID="lbtBack" runat="server" CssClass="link-btn" Text="Trở lại" CommandName="Back"></asp:LinkButton></td></tr>
                    </table>
                </ItemTemplate>
            </asp:Repeater>                
        </asp:Panel>                
    </div>        
</div>    
</asp:Content>